package com.cy.cy2025.view

import android.content.Context
import android.os.Build
import android.util.AttributeSet
import android.view.WindowInsets
import android.widget.FrameLayout
import androidx.annotation.RequiresApi
import androidx.core.view.WindowInsetsCompat

class InsetsLayout @JvmOverloads constructor(
    context: Context, attrs: AttributeSet? = null
) : FrameLayout(context, attrs) {

    @RequiresApi(Build.VERSION_CODES.R)
    override fun onApplyWindowInsets(insets: WindowInsets?): WindowInsets? {
        val systemBars = insets?.getInsets(WindowInsetsCompat.Type.systemBars())
        systemBars?.let {
            setPadding(it.left, it.top, it.right, it.bottom)
        }
        return super.onApplyWindowInsets(insets)
    }

}